home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / mail110 / show.c < prev    next >
C/C++ Source or Header  |  1994-02-14  |  2KB  |  106 lines

  1. //=========================================================
  2. //    
  3. //    show.c
  4. //
  5. //    void bump(int direction)
  6. //
  7. //    void showmsg(int msg)
  8. //
  9. //==========================================================
  10.  
  11. // $Id: show.c,v 1.2 1994/02/08 23:33:54 gbj Exp user $
  12.  
  13. /*
  14. $Log: show.c,v $
  15.  * Revision 1.2  1994/02/08  23:33:54  gbj
  16.  * First public release.
  17.  *
  18.  * Revision 1.1  1994/02/08  03:16:14  gbj
  19.  * Initial revision
  20.  *
  21. */
  22.  
  23. #include "mailer.h"
  24. #include "utils.h"
  25.  
  26. static char buf[4096];
  27.  
  28. void bump(int direction)
  29. {
  30.     if (direction == 1 )
  31.     {
  32.         cmsg++;
  33.         if (cmsg > maxmsgno)
  34.             cmsg=0;
  35.     }
  36.     else if (direction == -1)
  37.     {
  38.         cmsg--;
  39.         if(cmsg < 0)
  40.             cmsg=maxmsgno;
  41.     }
  42.     return;
  43. }
  44.  
  45. void showmsg(int msg)
  46. {
  47.     FILE *xfd;
  48.     char *bp;
  49.     int res, c, done;
  50.     int line;
  51.     
  52.     if (msg < 0 || msg > maxmsgno)
  53.     {
  54.         fprintf(stderr, "Message %d does not exist\n", msg);
  55.         return;
  56.     }
  57.     
  58.     res=tmp_msg(msg, "show.$$$", FALSE, TRUE);
  59.     if (res)
  60.         return;
  61.     line=0;
  62.     printf("\n Message %d\n\n", msg);
  63.     xfd=fopen("show.$$$", "rb");
  64.     bp=fgets(buf, 4095, xfd);
  65.     while (bp != NULL)
  66.     {
  67.         scaneol(buf);
  68.         strcat(buf, "\n");
  69.         c='\0';
  70.         // Don't show X-Status:
  71.         if (strncmp(buf, "X-Status:", 9) != 0)
  72.         {
  73.             printf("%s", buf);
  74.             line++;
  75.             if (line > 15)
  76.             {
  77.                 done=FALSE;
  78.                 while (!done)
  79.                 {
  80.                     printf("\n(C)ontinue or (Q)uit? ");
  81.                     c=toupper(getche());
  82.                     putchar('\r');
  83.                     putchar('\n');
  84.                     if (c == 'C')
  85.                     {
  86.                         done=TRUE;
  87.                         line=0;
  88.                     }
  89.                     else if (c == 'Q')
  90.                         done=TRUE;
  91.                 }
  92.             }
  93.         }    
  94.         if (c != 'Q')
  95.             bp=fgets(buf, 4095, xfd);
  96.         else
  97.             bp=NULL;
  98.     }
  99.     fclose(xfd);
  100.     remove ("show.$$$");
  101.     printf("Press a key");
  102.     getch();
  103.     putchar('\n');
  104.     return;
  105. }
  106.